#include "etcd.hpp"
#include <gflags/gflags.h>
#include <thread>

DEFINE_bool(run_mode, false, "程序的运行模式,格式:true:发布模式/false:调试模式");
DEFINE_string(log_filename, "", "发布模式下使用的文件名");
DEFINE_int32(log_level, 0, "发布模式下设置的日志输出等级");
DEFINE_string(base_sevice, "/service", "服务监控根目录");
DEFINE_string(etcd_host, "http://127.0.0.1:2379", "服务注册中心地址");
DEFINE_string(instance_name, "/friend/instance", "当前实例名称");

void online(const std::string& service_name , const std::string& service_host)
{
    LOG_DEBUG("服务上线: {}-{}",service_name,service_host);
}
void offline(const std::string& service_name , const std::string& service_host)
{
    LOG_DEBUG("服务下线: {}-{}",service_name,service_host);
}
int main(int argc, char *argv[])
{
    google::ParseCommandLineFlags(&argc, &argv, true);
    init_logger(FLAGS_run_mode, FLAGS_log_filename, FLAGS_log_level);
    std::shared_ptr<Discoverer> client_ptr = std::make_shared<Discoverer>(FLAGS_etcd_host,FLAGS_base_sevice,online,offline);
    
    std::this_thread::sleep_for(std::chrono::seconds(600));
    return 0;
}